package com.lotsrc.baicao.module.sys.activity;

import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.Fragment;

import android.os.Bundle;

import com.lotsrc.appbase.base.BaseActivity;
import com.lotsrc.baicao.R;
import com.lotsrc.baicao.databinding.ActivitySysMainBinding;

public class SysMainActivity extends BaseActivity {

    ActivitySysMainBinding binding=null;
    private String fragmentName="";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        binding=ActivitySysMainBinding.inflate(getLayoutInflater());
        setContentView(binding.getRoot());
        fragmentName=getIntent().getStringExtra("fragmentName");
        initView();
    }

    @Override
    public void initView() {
        loadFragment(fragmentName);
    }

    @Override
    public void initViewEvent() {

    }

    @Override
    public void initObserve() {

    }

    //加载
    private void loadFragment(String fragmentName){
        try {
            Fragment fragment = (Fragment) Class.forName(fragmentName).newInstance();
            showFragment(R.id.flContent, fragment);
        }catch (Exception ex){
            ex.printStackTrace();
        }
    }
}